import { defHttp } from '/@/utils/http/axios';
import { MenuListResultModel } from './model/menuModel';

enum Api {
  GetRouteList = '/system/menu/route',
  GetUserRouteList = '/system/menu/app/{0}/route',
  GetMenuList = '/system/menu/select',
}

/**
 * @description: Get user menu based on id
 */

export const getMenuList = (code) => {
  const url = code ? Api.GetUserRouteList.replace('{0}', code) : Api.GetRouteList;
  return defHttp.get<MenuListResultModel>({ url: url });
};

export const getAllMenuList = () => {
  return defHttp.get<MenuListResultModel>({ url: Api.GetMenuList });
};
